﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AVIS.OutBound.Stores
{
    /// <summary>
    /// 门店的营业时间
    /// </summary>
    public class StoreHours
    {
        public int Id { get; set; }

        /// <summary>
        /// 门店编号
        /// </summary>
        public string StoreCode { get; set; }

        /// <summary>
        /// 星期天开始营业时间
        /// </summary>
        public string SundayOpen { get; set; }

        /// <summary>
        /// 星期天结束营业时间
        /// </summary>
        public string SundayClose { get; set; }

        /// <summary>
        /// 星期天开始营业时间2（如果中午有休息，则该值有效，如：08:30-12:00 17:00-20:00）
        /// </summary>
        public string SundayOpen2 { get; set; }

        /// <summary>
        /// 星期天结束营业时间2（如果中午有休息，则该值有效，如：08:30-12:00 17:00-20:00）
        /// </summary>
        public string SundayClose2 { get; set; }
        
        /// <summary>
        /// 星期一开始营业时间
        /// </summary>
        public string MondayOpen { get; set; }

        /// <summary>
        /// 星期一结束营业时间
        /// </summary>
        public string MondayClose { get; set; }

        /// <summary>
        /// 星期一开始营业时间2
        /// </summary>
        public string MondayOpen2 { get; set; }

        /// <summary>
        /// 星期一结束营业时间2
        /// </summary>
        public string MondayClose2 { get; set; }

        /// <summary>
        /// 星期二开始营业时间
        /// </summary>
        public string TuesdayOpen { get; set; }

        /// <summary>
        /// 星期二结束营业时间
        /// </summary>
        public string TuesdayClose { get; set; }

        /// <summary>
        /// 星期二开始营业时间2
        /// </summary>
        public string TuesdayOpen2 { get; set; }

        /// <summary>
        /// 星期二结束营业时间2
        /// </summary>
        public string TuesdayClose2 { get; set; }

        /// <summary>
        /// 星期三开始营业时间
        /// </summary>
        public string WednesdayOpen { get; set; }

        /// <summary>
        /// 星期三结束营业时间
        /// </summary>
        public string WednesdayClose { get; set; }

        /// <summary>
        /// 星期三开始营业时间2
        /// </summary>
        public string WednesdayOpen2 { get; set; }

        /// <summary>
        /// 星期三结束营业时间2
        /// </summary>
        public string WednesdayClose2 { get; set; }

        /// <summary>
        /// 星期四开始营业时间
        /// </summary>
        public string ThursdayOpen { get; set; }

        /// <summary>
        /// 星期四结束营业时间
        /// </summary>
        public string ThursdayClose { get; set; }

        /// <summary>
        /// 星期四开始营业时间2
        /// </summary>
        public string ThursdayOpen2 { get; set; }

        /// <summary>
        /// 星期四结束营业时间2
        /// </summary>
        public string ThursdayClose2 { get; set; }

        /// <summary>
        /// 星期五开始营业时间
        /// </summary>
        public string FridayOpen { get; set; }

        /// <summary>
        /// 星期五结束营业时间
        /// </summary>
        public string FridayClose { get; set; }

        /// <summary>
        /// 星期五开始营业时间2
        /// </summary>
        public string FridayOpen2 { get; set; }

        /// <summary>
        /// 星期五结束营业时间2
        /// </summary>
        public string FridayClose2 { get; set; }

        /// <summary>
        /// 星期六开始营业时间
        /// </summary>
        public string SaturdayOpen { get; set; }

        /// <summary>
        /// 星期六结束营业时间
        /// </summary>
        public string SaturdayClose { get; set; }

        /// <summary>
        /// 星期六开始营业时间2
        /// </summary>
        public string SaturdayOpen2 { get; set; }

        /// <summary>
        /// 星期六结束营业时间2
        /// </summary>
        public string SaturdayClose2 { get; set; }

        /// <summary>
        /// 获取指定星期几的营业时间
        /// </summary>
        public string GetHours(DayOfWeek dayOfWeek)
        {
            var strHours = string.Empty;
            if (dayOfWeek == DayOfWeek.Friday && !string.IsNullOrEmpty(FridayOpen))
            {
                strHours = string.Format("{0}-{1}", FridayOpen, FridayClose);
                if (!string.IsNullOrEmpty(FridayOpen2) && FridayOpen2 != "00:00")
                {
                    strHours += string.Format(";{0}-{1}", FridayOpen2, FridayClose2);
                }
            }
            else if (dayOfWeek == DayOfWeek.Monday && !string.IsNullOrEmpty(MondayOpen))
            {
                strHours = string.Format("{0}-{1}", MondayOpen, MondayClose);
                if (!string.IsNullOrEmpty(MondayOpen2) && MondayOpen2 != "00:00")
                {
                    strHours += string.Format(";{0}-{1}", MondayOpen2, MondayClose2);
                }
            }
            else if (dayOfWeek == DayOfWeek.Saturday && !string.IsNullOrEmpty(SaturdayOpen))
            {
                strHours = string.Format("{0}-{1}", SaturdayOpen, SaturdayClose);
                if (!string.IsNullOrEmpty(SaturdayOpen2) && SaturdayOpen2 != "00:00")
                {
                    strHours += string.Format(";{0}-{1}", SaturdayOpen2, SaturdayClose2);
                }
            }
            else if (dayOfWeek == DayOfWeek.Sunday && !string.IsNullOrEmpty(SundayOpen))
            {
                strHours = string.Format("{0}-{1}", SundayOpen, SundayClose);
                if (!string.IsNullOrEmpty(SundayOpen2) && SundayOpen2 != "00:00")
                {
                    strHours += string.Format(";{0}-{1}", SundayOpen2, SundayClose2);
                }
            }
            else if (dayOfWeek == DayOfWeek.Thursday && !string.IsNullOrEmpty(ThursdayOpen))
            {
                strHours = string.Format("{0}-{1}", ThursdayOpen, ThursdayClose);
                if (!string.IsNullOrEmpty(ThursdayOpen2) && ThursdayOpen2 != "00:00")
                {
                    strHours += string.Format(";{0}-{1}", ThursdayOpen2, ThursdayClose2);
                }
            }
            else if (dayOfWeek == DayOfWeek.Tuesday && !string.IsNullOrEmpty(TuesdayOpen))
            {
                strHours = string.Format("{0}-{1}", TuesdayOpen, TuesdayClose);
                if (!string.IsNullOrEmpty(TuesdayOpen2) && TuesdayOpen2 != "00:00")
                {
                    strHours += string.Format(";{0}-{1}", TuesdayOpen2, TuesdayClose2);
                }
            }
            else if (dayOfWeek == DayOfWeek.Wednesday && !string.IsNullOrEmpty(WednesdayOpen))
            {
                strHours = string.Format("{0}-{1}", WednesdayOpen, WednesdayClose);
                if (!string.IsNullOrEmpty(WednesdayOpen2) && WednesdayOpen2 != "00:00")
                {
                    strHours += string.Format(";{0}-{1}", WednesdayOpen2, WednesdayClose2);
                }
            }

            return strHours;
        }
    }
}
